package ink.lovejinhu.leetcode;

/**
 * @author jinhu
 * created 2021-07-12 14:29
 */
public class Solution_0509 {
    public int fib(int n) {
        if (n == 0) return 0;
        if (n == 1) return 1;
        int[] ints = new int[n + 1];
        ints[0] = 0;
        ints[1] = 1;
        for (int i = 2; i <= n; i++) {
            ints[i] = ints[i - 1] + ints[i - 2];
        }
        return ints[n];
    }
}
